Integrand size = 16, antiderivative size = 126 \[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=\frac {x^2}{4}+\frac {b \sqrt {\pi } \cos \left (2 a+\frac {b^2}{2 c}\right ) \operatorname {FresnelC}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {\pi }}\right )}{8 c^{3/2}}+\frac {b \sqrt {\pi } \operatorname {FresnelS}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {\pi }}\right ) \sin \left (2 a+\frac {b^2}{2 c}\right )}{8 c^{3/2}}+\frac {\sin \left (2 a+2 b x-2 c x^2\right )}{8 c} \]
1/4*x^2+1/8*sin(-2*c*x^2+2*b*x+2*a)/c+1/8*b*cos(2*a+1/2*b^2/c)*FresnelC((- 2*c*x+b)/c^(1/2)/Pi^(1/2))*Pi^(1/2)/c^(3/2)+1/8*b*FresnelS((-2*c*x+b)/c^(1 /2)/Pi^(1/2))*sin(2*a+1/2*b^2/c)*Pi^(1/2)/c^(3/2)
Time = 0.18 (sec) , antiderivative size = 122, normalized size of antiderivative = 0.97 \[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=\frac {-b \sqrt {\pi } \cos \left (2 a+\frac {b^2}{2 c}\right ) \operatorname {FresnelC}\left (\frac {-b+2 c x}{\sqrt {c} \sqrt {\pi }}\right )-b \sqrt {\pi } \operatorname {FresnelS}\left (\frac {-b+2 c x}{\sqrt {c} \sqrt {\pi }}\right ) \sin \left (2 a+\frac {b^2}{2 c}\right )+\sqrt {c} \left (2 c x^2+\sin (2 (a+x (b-c x)))\right )}{8 c^{3/2}} \]
(-(b*Sqrt[Pi]*Cos[2*a + b^2/(2*c)]*FresnelC[(-b + 2*c*x)/(Sqrt[c]*Sqrt[Pi] )]) - b*Sqrt[Pi]*FresnelS[(-b + 2*c*x)/(Sqrt[c]*Sqrt[Pi])]*Sin[2*a + b^2/( 2*c)] + Sqrt[c]*(2*c*x^2 + Sin[2*(a + x*(b - c*x))]))/(8*c^(3/2))
Time = 0.24 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3948, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int x \sin ^2\left (a+b x-c x^2\right ) \, dx\) |
\(\Big \downarrow \) 3948 |
\(\displaystyle \int \left (\frac {x}{2}-\frac {1}{2} x \cos \left (2 a+2 b x-2 c x^2\right )\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {\sqrt {\pi } b \cos \left (2 a+\frac {b^2}{2 c}\right ) \operatorname {FresnelC}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {\pi }}\right )}{8 c^{3/2}}+\frac {\sqrt {\pi } b \sin \left (2 a+\frac {b^2}{2 c}\right ) \operatorname {FresnelS}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {\pi }}\right )}{8 c^{3/2}}+\frac {\sin \left (2 a+2 b x-2 c x^2\right )}{8 c}+\frac {x^2}{4}\) |
x^2/4 + (b*Sqrt[Pi]*Cos[2*a + b^2/(2*c)]*FresnelC[(b - 2*c*x)/(Sqrt[c]*Sqr t[Pi])])/(8*c^(3/2)) + (b*Sqrt[Pi]*FresnelS[(b - 2*c*x)/(Sqrt[c]*Sqrt[Pi]) ]*Sin[2*a + b^2/(2*c)])/(8*c^(3/2)) + Sin[2*a + 2*b*x - 2*c*x^2]/(8*c)
3.1.21.3.1 Defintions of rubi rules used
Int[((d_.) + (e_.)*(x_))^(m_.)*Sin[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]^(n_), x_Symbol] :> Int[ExpandTrigReduce[(d + e*x)^m, Sin[a + b*x + c*x^2]^n, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && IGtQ[n, 1]
Time = 0.36 (sec) , antiderivative size = 99, normalized size of antiderivative = 0.79
method | result | size |
default | \(\frac {x^{2}}{4}+\frac {\sin \left (-2 c \,x^{2}+2 b x +2 a \right )}{8 c}-\frac {b \sqrt {\pi }\, \left (\cos \left (\frac {4 a c +b^{2}}{2 c}\right ) \operatorname {C}\left (\frac {2 c x -b}{\sqrt {\pi }\, \sqrt {c}}\right )+\sin \left (\frac {4 a c +b^{2}}{2 c}\right ) \operatorname {S}\left (\frac {2 c x -b}{\sqrt {\pi }\, \sqrt {c}}\right )\right )}{8 c^{\frac {3}{2}}}\) | \(99\) |
risch | \(-\frac {b \sqrt {\pi }\, {\mathrm e}^{-\frac {i \left (4 a c +b^{2}\right )}{2 c}} \operatorname {erf}\left (\sqrt {-2 i c}\, x +\frac {i b}{\sqrt {-2 i c}}\right )}{16 c \sqrt {-2 i c}}+\frac {b \sqrt {\pi }\, {\mathrm e}^{\frac {i \left (4 a c +b^{2}\right )}{2 c}} \sqrt {2}\, \operatorname {erf}\left (-\sqrt {2}\, \sqrt {i c}\, x +\frac {i b \sqrt {2}}{2 \sqrt {i c}}\right )}{32 c \sqrt {i c}}+\frac {x^{2}}{4}+\frac {\sin \left (-2 c \,x^{2}+2 b x +2 a \right )}{8 c}\) | \(137\) |
1/4*x^2+1/8*sin(-2*c*x^2+2*b*x+2*a)/c-1/8*b/c^(3/2)*Pi^(1/2)*(cos(1/2*(4*a *c+b^2)/c)*FresnelC(1/Pi^(1/2)/c^(1/2)*(2*c*x-b))+sin(1/2*(4*a*c+b^2)/c)*F resnelS(1/Pi^(1/2)/c^(1/2)*(2*c*x-b)))
Time = 0.29 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.06 \[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=-\frac {\pi b \sqrt {\frac {c}{\pi }} \cos \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right ) \operatorname {C}\left (\frac {{\left (2 \, c x - b\right )} \sqrt {\frac {c}{\pi }}}{c}\right ) + \pi b \sqrt {\frac {c}{\pi }} \operatorname {S}\left (\frac {{\left (2 \, c x - b\right )} \sqrt {\frac {c}{\pi }}}{c}\right ) \sin \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right ) - 2 \, c^{2} x^{2} + 2 \, c \cos \left (c x^{2} - b x - a\right ) \sin \left (c x^{2} - b x - a\right )}{8 \, c^{2}} \]
-1/8*(pi*b*sqrt(c/pi)*cos(1/2*(b^2 + 4*a*c)/c)*fresnel_cos((2*c*x - b)*sqr t(c/pi)/c) + pi*b*sqrt(c/pi)*fresnel_sin((2*c*x - b)*sqrt(c/pi)/c)*sin(1/2 *(b^2 + 4*a*c)/c) - 2*c^2*x^2 + 2*c*cos(c*x^2 - b*x - a)*sin(c*x^2 - b*x - a))/c^2
\[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=\int x \sin ^{2}{\left (a + b x - c x^{2} \right )}\, dx \]
Result contains complex when optimal does not.
Time = 0.58 (sec) , antiderivative size = 610, normalized size of antiderivative = 4.84 \[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=\frac {\sqrt {2} {\left ({\left (-\left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} + \left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b^{2} \cos \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right ) + {\left (\left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} - \left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b^{2} \sin \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right ) - 2 \, {\left ({\left (-\left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} + \left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b c \cos \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right ) + {\left (\left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} - \left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\sqrt {\frac {1}{2}} \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b c \sin \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right )\right )} x + 2 \, \sqrt {2} {\left (4 \, c^{2} x^{2} - c {\left (-i \, e^{\left (\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{2 \, c}\right )} + i \, e^{\left (-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{2 \, c}\right )}\right )} \cos \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right ) + c {\left (e^{\left (\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{2 \, c}\right )} + e^{\left (-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{2 \, c}\right )}\right )} \sin \left (\frac {b^{2} + 4 \, a c}{2 \, c}\right )\right )} \sqrt {\frac {4 \, c^{2} x^{2} - 4 \, b c x + b^{2}}{c}}\right )}}{64 \, c^{2} \sqrt {\frac {4 \, c^{2} x^{2} - 4 \, b c x + b^{2}}{c}}} \]
1/64*sqrt(2)*((-(I - 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1) + (I + 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sq rt(-(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b^2*cos(1/2*(b^2 + 4*a*c)/ c) + ((I + 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt((4*I*c^2*x^2 - 4*I*b*c* x + I*b^2)/c)) - 1) - (I - 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt(-(4*I*c ^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b^2*sin(1/2*(b^2 + 4*a*c)/c) - 2*((- (I - 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I* b^2)/c)) - 1) + (I + 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt(-(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b*c*cos(1/2*(b^2 + 4*a*c)/c) + ((I + 1)*sq rt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1) - (I - 1)*sqrt(2)*sqrt(pi)*(erf(sqrt(1/2)*sqrt(-(4*I*c^2*x^2 - 4*I*b*c *x + I*b^2)/c)) - 1))*b*c*sin(1/2*(b^2 + 4*a*c)/c))*x + 2*sqrt(2)*(4*c^2*x ^2 - c*(-I*e^(1/2*(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c) + I*e^(-1/2*(4*I*c^ 2*x^2 - 4*I*b*c*x + I*b^2)/c))*cos(1/2*(b^2 + 4*a*c)/c) + c*(e^(1/2*(4*I*c ^2*x^2 - 4*I*b*c*x + I*b^2)/c) + e^(-1/2*(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2) /c))*sin(1/2*(b^2 + 4*a*c)/c))*sqrt((4*c^2*x^2 - 4*b*c*x + b^2)/c))/(c^2*s qrt((4*c^2*x^2 - 4*b*c*x + b^2)/c))
Result contains complex when optimal does not.
Time = 0.35 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.38 \[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=\frac {1}{4} \, x^{2} - \frac {\frac {i \, \sqrt {\pi } b \operatorname {erf}\left (-\frac {1}{2} i \, \sqrt {c} {\left (2 \, x - \frac {b}{c}\right )} {\left (\frac {i \, c}{{\left | c \right |}} + 1\right )}\right ) e^{\left (-\frac {i \, b^{2} + 4 i \, a c}{2 \, c}\right )}}{\sqrt {c} {\left (\frac {i \, c}{{\left | c \right |}} + 1\right )}} - i \, e^{\left (2 i \, c x^{2} - 2 i \, b x - 2 i \, a\right )}}{16 \, c} - \frac {-\frac {i \, \sqrt {\pi } b \operatorname {erf}\left (\frac {1}{2} i \, \sqrt {c} {\left (2 \, x - \frac {b}{c}\right )} {\left (-\frac {i \, c}{{\left | c \right |}} + 1\right )}\right ) e^{\left (-\frac {-i \, b^{2} - 4 i \, a c}{2 \, c}\right )}}{\sqrt {c} {\left (-\frac {i \, c}{{\left | c \right |}} + 1\right )}} + i \, e^{\left (-2 i \, c x^{2} + 2 i \, b x + 2 i \, a\right )}}{16 \, c} \]
1/4*x^2 - 1/16*(I*sqrt(pi)*b*erf(-1/2*I*sqrt(c)*(2*x - b/c)*(I*c/abs(c) + 1))*e^(-1/2*(I*b^2 + 4*I*a*c)/c)/(sqrt(c)*(I*c/abs(c) + 1)) - I*e^(2*I*c*x ^2 - 2*I*b*x - 2*I*a))/c - 1/16*(-I*sqrt(pi)*b*erf(1/2*I*sqrt(c)*(2*x - b/ c)*(-I*c/abs(c) + 1))*e^(-1/2*(-I*b^2 - 4*I*a*c)/c)/(sqrt(c)*(-I*c/abs(c) + 1)) + I*e^(-2*I*c*x^2 + 2*I*b*x + 2*I*a))/c
Timed out. \[ \int x \sin ^2\left (a+b x-c x^2\right ) \, dx=\int x\,{\sin \left (-c\,x^2+b\,x+a\right )}^2 \,d x \]